import React, { useRef } from "react";

const App = () => {
  const abc = useRef();
  const ipt = useRef();

  const fn = () => {
    console.log(abc.current);
  };

  const fn2 = () => {
    console.log(ipt.current.value);
  };

  return (
    <>
      <h2>useRef</h2>
      <div ref={abc}>哈哈哈</div>
      <button onClick={fn}>btn</button>

      <input type="text" ref={ipt} />
      <button onClick={fn2}>btn2</button>
    </>
  );
};

export default App;
